package com.ext.aic.apis.content;

import android.content.Context;

import androidx.lifecycle.LifecycleOwner;

import com.ext.aic.apis.ApiDefine;
import com.ext.aic.apis.ApiPaths;
import com.ext.aic.apis.RequestResponse;
import com.ext.aic.beans.response.ContentDetailResponse;
import com.hjq.http.EasyHttp;

import java.text.MessageFormat;

public class ContentDetailRequest {

    protected void onContentDetailSuccess(ContentDetailResponse response) {

    }

    public void request(Context context, LifecycleOwner lifecycleOwner, String contentId) {
        String apiPath = MessageFormat.format(ApiPaths.contentDetail, contentId);
        ApiDefine apiDefine = new ApiDefine(apiPath);
        EasyHttp.get(lifecycleOwner).api(apiDefine).request(new RequestResponse<ContentDetailResponse>(context, true) {
            @Override
            protected void onSuccess(ContentDetailResponse response) {
                onContentDetailSuccess(response);
            }
        });
    }
}
